home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
TECHNICA
/
AUTOCAD
/
H108.ZIP
/
MM10.ZIP
/
MM.DOC
next >
Wrap
Text File
|
1991-08-01
|
12KB
|
223 lines
MM.DOC
AutoCAD tm Macro Maker V 1.00
Author: Scott Hares 1108 Kelez Dr. San Jose Ca 95120
Voice: 408-866-5466
CompuServe tm ID 73730,1643
Copyright (C) 1991 Scott Hares
INTRODUCTION:
MM is a group of utilities for instantly writing and managing keyboard
macros. Macros can be recorded to handle a one time task that might be very
tedious or keyboard intensive. A user can also define a group of macros for
such things as Osnap control, save the list of macros as a file, and load the
macro file for use in the next editing session manually or automatically. MM
utilizes the ansi driver to assign macros to keystrokes. Because of this, MM
uses very little memory compared to TSR types of keyboard macros. To further
reduce the amount of memory required by MM I have supplied both the raw source
code version of MM (MMS.lsp), and Kelvinated source code (MMK.lsp). The source
code version is for the reference of those interested in viewing the code. The
Kelvinated is optimized for memory requirements and load time. Most users will
prefer to use the Kelvinated MMK.lsp. Just rename MMK.lsp or MMS.lsp to MM.lsp
Both files will load and run identically except that MMK.lsp might load a few
seconds faster than MMS.lsp. Be sure to read the READ.ME for more information
on Kelvination.
REQUIREMENTS: Loading, and ansi.sys
MM is an AutoLISP file and does need to be loaded into memory before
it can be used. Place the mm.lsp file in your working AutoCAD directory or
another directory if preferred. From the AutoCAD command prompt enter the
following: (load "mm") and hit return. If you copy mm.lsp to a
directory other than the working AutoCAD directory, the you must specify the
path to the mm.lsp file. (load "c:/acad/utils/mm") for example would be used
if mm.lsp was installed in a directory c:\acad\utils. Note the use of the
forward slash instead of the usual backslash in path specification. If these
steps are followed correctly, then you will see a two line introduction to MM.
ANSI.SYS driver must be installed. If this system driver is not loaded
during the boot procedure, then MM will not work. If you are not sure, then
look at the contents of your config.sys file. You should see a line similar
to the following: device = c:\dos\ansi.sys
I cannot guarantee that MM will work with the many extended or enhanced ansi
drivers, but those are usually well behaved, and quite compatible with the
ansi driver issued with DOS.
Summary Of MM Commands:
MM Body of MacroMaker program
MMW Write Macro File to Hard Disk
MMLL Re-Initialize Unloaded Macros
MMUL Unload Macros
MMLF Load Macro File from Hard Disk
SIMPLE MACRO DEFINITION: MacroMaker
Alright, suppose you want to change text height of a group of text
strings. One way is the use the change command to select the text strings
using cross or window. Then by hitting return several times, you would be
prompted to enter new height for text. After hitting return several more times
you would be prompted again for new text height, and on.. and on... until you
did this for each text string selected. Using MM you could assign this
sequence to a single keystroke, and save yourself a lot of typing. After
successfully loading MM it is invoked by type MM at the AutoCAD command
prompt. You will be prompted to press a key to re-define. You can use any
key including ALT- , SHIFT-, and CNTL- key combinations. Some keys are
intercepted by AutoCAD and cannot by used for redefinition. Next you will
be prompted to start entering the keystrokes you want assigned to that
key. Terminate the recording by hitting the ESCape key.
Example: enter mm
prompt - "Press the key you wish to assign macro to: "
press - ALT-A key
prompt - "Enter the keystrokes to be recorded to macro: "
enter - I_pressed_ALT-A_key
hit ESCape key
You have assigned the text string "I_pressed_ALT-A_key" to the ALT-A key. Try
pressing the ALT-A key. The above string should echo onto the command line.
This macro could have just as easily been an AutoCAD command, set of commands,
or response to command prompts. Try assigning an AutoCAD command to ALT-A. You
can redefine a key over and over again during an editing session.
LOADING and UNLOADING MACROS: MMUnloadList and MMLoadList
If for what ever reason, you decide you want your keyboard to operate without
macro assignments, you can unload or load macros at will within the same
editing session. To unload macros type MMUL at the command prompt. In the
above example we assigned a text string to the ALT-A key. If for some reason
you need to use ALT-A (shelling to DOS to run another utility for example),
you can type MMUL and ALT-A would no longer reflect our macro we defined
above. This is a temporary disabling of defined macros. Temporary because
those macros could be made available again with MMLL. Try this now, enter MMUL
to unload the macro we defined above. Now hit ALT-A and nothing happens. Now
enter MMLL and hit ALT-A and our ALT-A macro is back again. If you want to
undefine a single macro assignment, then you should simply assign the
original character to the keystroke. For example if you have recorded a macro
to the @ key and now want to eliminated that macro so that you can use that
character, simply redefine the @ key with a @ character.
SAVING AND LOADING MACRO FILES: MMWrite MMLoadFile
Now suppose for example you have written macros assigning Osnap commands to
the ALT- number keys, and you want to save these macros for use in the future.
You can save your macros to a file with MMW. You will be prompted for a file
name. No file extension will be assumed or presumed about the macro file. If
you use a illegal file name then you might have trouble finding the file
later on. Once you give a file name to save macros under, you can load this
file manually or automatically every time you enter the drawing editor.
Automatic file loading is covered in the next section. For now we will discuss
only manual loading of macro files. When you leave the AutoCAD drawing editor
your macros are unloaded and must be reloaded again. If you saved your macros
to a file you can do this with MMLF. Enter MMLF at the command prompt and you
will be prompted to enter the name of a macro file to load. If you give a
valid macro file name the files macros will be loaded and the macros available
for use immediately. After a macro file is loaded all of the macro managing
functions discussed will apply.
LOADING MACRO FILES AUTOMATICALLY:
Loading a macro file requires a bit of pseudo programming but every attempt
will be made to make this as straight forward and simple as possible. Two
things are required to perform automatic macro file loading. First is to
create a very simple script file as follows:
example listing for MM.scr:
mmlf
acad.mm
(graphscr)
That's it!. only three lines. This script file (which must have a file
extension of .scr) assumes that you have saved a macro file (using MMW
described above) and that the MM.lsp package has already been loaded. Any
macro file name you whish to use can be substituted for the acad.mm. , but
those of you new to AutoLISP might ask "how do we load MM.lsp automatically?"
Unless you are working with a very old version of AutoCAD, AutoLISP has a
function called s::startup. As you know, when you enter the drawing editor,
AutoCAD looks for ACAD.lsp. if AutoCAD finds this file it will automatically
load it as the last job upon entering the drawing editor. If AutoCAD finds a
s::startup function in the ACAD.lsp, then the contents of s::startup will be
executed automatically. This is the key to automatic loading of macro files.
Here is the listing:
(defun s::startup()
(command "UNDEFINE" "End")
(command "UNDEFINE" "Quit")
(load "mm")
(command "script" "MM")
)
When you enter the AutoCAD drawing editor and these automatic events occur,
you will notice (for single screen users only) that your monitor will briefly
switch to the text screen (as if you had hit the F1 key) and then flip back to
the graphics screen. This is because the your single monitor cannot be in a
graphics mode when MM calls functions from the ansi driver. There is nothing I
can do about this problem except hope that grateful users can ignore it. You
will also notice that if you answer "N" to the quit prompt or cancel out of
the quit command, then macros will unload. I have tried to keep MM as small a
program as possible, and to eliminate this problem would make MM larger and
bulkier than it needs to be. Such an occurrence described above should be
rare enough to ignore such a problem, but every piece of user input is valued.
When implementing the above AutoLISP code one should first search for the
existence of the ACAD.lsp file. If it does not exist, then it is safe to
create (using your favorite text editor) this file with the above code being
the only entries. If an ACAD.lsp already exists, the you should search the
ACAD.lsp code for the key word s::startup . If no s::startup is found in an
existing ACAD.lsp file then the above code can be added, but you must be
careful not to add this code with in some other lisp programs parenthesis.
Usually it is safe to add this code to the very top or very bottom of an
ACAD.lsp. If s::startup is found in an existing ACAD.lsp then you must be
extra careful to add the following code only.
(command "UNDEFINE" "End")
(command "UNDEFINE" "Quit")
(load "mm")
(command "script" "MM")
In this case, be careful not to add this code indiscriminately. This code
should be imbedded in the s::startup function, but not imbedded in any other
code that may exist in the s::startup function. Before adding such code, save
your existing ACAD.lsp to something like Acad_lsp.old as a backup incase you find
yourself in trouble. Because I cannot look at the s::Startup code for end
users machines I can be of little more help than that I'm afraid. I can however
offer explicit assistance to users (registered or not) via compuserve Email,
or U.S. mail.
OLDER VERSIONS OF AutoCAD and AUTOMATIC MACRO FILE LOADING:
If you are using a very old version of AutoCAD and AutoLISP, then s::startup
described above might not be a valid AutoLISP function. In this case you are
stuck!. You can however use a similar script file as above but this script
must be ran manually upon entering the drawing editor.
listing:
(load "mm")
mmlf
acad.mm
TECHNIQUES:
I have designed MM with the hopes that it can be limited only by users
imagination. Typically When we hear of a "Hot Key" sequence, reference is
being made to a Terminate and Stay Resident program. MM allows a sort of
pseudo Hot Key invocation of AutoCAD commands, AutoLISP functions, external
programs listed in ACAD.PGP as well as automating tedious repetitive
keystrokes. I hope to hear from all users, some comments regarding new
features, problems, complaints, or any other feedback you might have
(registered or not).
Thank You for evaluating MM and please feel free to give copies to your friends
and associates. I hope you enjoy MM as much as I did writing it.
Copies distributed must be complete without any modifications or edits, and
compensation for such distribution is not allowed unless expressly requested
and excepted by the author of MM. The author cannot be responsible for system
portability nor loss of any data caused by the use or misuse of MM.
P.S. My lawyer makes me say this legal mumbo jumbo stuff.
All software and documentation are
Copyright (c) 1990 1991 by
Scott D. Hares
1198 Capri drive
Campbell CA 95008
CompuServe ID 73730,1643
AutoCAD and AutoLISP are registered trademark of AutoDESK inc.